package com.dididoctor.patient.Utils;

import android.content.Context;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;

/**
 * 项目名称：Psd
 * 类描述：点赞的动画效果
 * 创建人：李营
 * 创建时间：2015/7/10 16:45
 * 修改人：
 * 修改时间：2015/7/10 16:45
 * 修改备注：
 */
public class CheckAnimotion extends Animation {
    private Context mcontext;
    private View view;
    private Animation trans;
    private Animation alpha;
    private AnimationSet set;

    public CheckAnimotion(Context mcontext, View view) {
        this.mcontext = mcontext;
        this.view = view;
        trans = new TranslateAnimation(0, 0, 0, DensityUtil.dip2px(mcontext,
                -15));
        trans.setDuration(500);
        alpha = new AlphaAnimation(1.0f, 0f);
        alpha.setDuration(500);
        set = new AnimationSet(true);
        set.addAnimation(trans);
        set.addAnimation(alpha);
    }


    public void startAnimations() {
        view.setVisibility(view.VISIBLE);
        set.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                view.setVisibility(View.GONE);
            }
        });
        view.startAnimation(set);
    }
}
